﻿using System.Xml.Serialization;
using System.Device.Location;
using Kiva7.Translations;

namespace Kiva7.DataClasses
{
    public class Geo
    {
        [XmlElement("level")]
        public string Level { get; set; }
        [XmlElement("pairs")]
        public string Pairs { get; set; }
        [XmlElement("type")]
        public string GeoType { get; set; } // town country exact
        //- <geo>
        //  <level>town</level> 
        //  <pairs>33.871944 35.509722</pairs> 
        //  <type>point</type> 
        //  </geo>

        [XmlIgnore]
        public GeoCoordinate Coordinate
        {
            get
            {
                string[] x = Pairs.Split(' ');
                return new GeoCoordinate(
                    double.Parse(x[0], TranslatorContext.NumberFormat), 
                    double.Parse(x[1], TranslatorContext.NumberFormat));
            }
    }
        
    }
}
